//
//  HomeViewController.m
//  Component
//
//  Created by Andy_chen on 16/3/21.
//  Copyright © 2016年 Andycchen. All rights reserved.
//

#import "HomeViewController.h"
#import "SDAutoLayout/UIView+SDAutoLayout.h"
#import "CTMediator+QRCodeActions.h"
#import "CTMediator+ImagePickerActions.h"
@interface HomeViewController()
@property (nonatomic, strong) UIButton *pushButton;
@end

@implementation HomeViewController

#pragma mark - life cycle

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.view.backgroundColor = [UIColor greenColor];
    self.title = @"首页";
    [self pushButton];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - UITableViewDelegate

#pragma mark - CustomDelegate

#pragma mark - event Response
- (void)jumpToOtherApp {
    UIViewController *viewController = [[CTMediator sharedInstance] CTMediator_viewControllerForImagePicker];
    [self.navigationController pushViewController:viewController animated:YES];
}

#pragma mark - private methods

#pragma mark - getters and setters
- (UIButton *)pushButton {
    
    if (!_pushButton) {
        _pushButton = [[UIButton alloc]initWithFrame:CGRectZero];
        _pushButton.backgroundColor = [UIColor redColor];
        [_pushButton addTarget:self action:@selector(jumpToOtherApp) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:_pushButton];
        
        _pushButton.sd_layout
        .centerXEqualToView(self.view)
        .centerYEqualToView(self.view)
        .widthIs(100)
        .heightIs(50);
    }
    return _pushButton;
}

@end
